<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>03-03面试题学习 | 个人博客</title><meta name="keywords" content="Java基础,错题集,知识点补充"><meta name="author" content="蔡哞哞"><meta name="copyright" content="蔡哞哞"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="description" content="刷面试题时学到的知识">
<meta property="og:type" content="article">
<meta property="og:title" content="03-03面试题学习">
<meta property="og:url" content="https://caixm1025.gitee.io/2021/03/03/03-03%E9%9D%A2%E8%AF%95%E9%A2%98%E5%AD%A6%E4%B9%A0/index.html">
<meta property="og:site_name" content="个人博客">
<meta property="og:description" content="刷面试题时学到的知识">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://caixm1025.gitee.io/img/%E5%9B%BE%E7%89%873.jpg">
<meta property="article:published_time" content="2021-03-03T15:05:54.000Z">
<meta property="article:modified_time" content="2021-03-03T15:07:55.758Z">
<meta property="article:author" content="蔡哞哞">
<meta property="article:tag" content="Java基础">
<meta property="article:tag" content="错题集">
<meta property="article:tag" content="知识点补充">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://caixm1025.gitee.io/img/%E5%9B%BE%E7%89%873.jpg"><link rel="shortcut icon" href="/everyday/img/25.png"><link rel="canonical" href="https://caixm1025.gitee.io/2021/03/03/03-03%E9%9D%A2%E8%AF%95%E9%A2%98%E5%AD%A6%E4%B9%A0/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/everyday/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>var GLOBAL_CONFIG = { 
  root: '/everyday/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}

// https://stackoverflow.com/questions/16839698/jquery-getscript-alternative-in-native-javascript
const getScript = url => new Promise((resolve, reject) => {
  const script = document.createElement('script')
  script.src = url
  script.async = true
  script.onerror = reject
  script.onload = script.onreadystatechange = function() {
    const loadState = this.readyState
    if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
    script.onload = script.onreadystatechange = null
    resolve()
  }
  document.head.appendChild(script)
})</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-03-03 23:07:55'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = 'false'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
   if (asideStatus === 'hide') {
     document.documentElement.classList.add('hide-aside')
   } else {
     document.documentElement.classList.remove('hide-aside')
   }
}})()</script><meta name="generator" content="Hexo 5.3.0"><link rel="alternate" href="/everyday/atom.xml" title="个人博客" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="/everyday/img/image011.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/everyday/archives/"><div class="headline">文章</div><div class="length-num">28</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/everyday/tags/"><div class="headline">标签</div><div class="length-num">19</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/everyday/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/everyday/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/everyday/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page" href="/everyday/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/everyday/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(/everyday/img/%E5%9B%BE%E7%89%873.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/everyday/">个人博客</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/everyday/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/everyday/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page" href="/everyday/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/everyday/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/everyday/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">03-03面试题学习</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-03-03T15:05:54.000Z" title="发表于 2021-03-03 23:05:54">2021-03-03</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-03-03T15:07:55.758Z" title="更新于 2021-03-03 23:07:55">2021-03-03</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/everyday/categories/%E9%9D%A2%E8%AF%95/">面试</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h3 id="1、下面代码运行结果是（）"><a href="#1、下面代码运行结果是（）" class="headerlink" title="1、下面代码运行结果是（）"></a>1、下面代码运行结果是（）</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span></span>&#123;	</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">add</span><span class="params">(<span class="keyword">int</span> a,<span class="keyword">int</span> b)</span></span>&#123;	</span><br><span class="line">         <span class="keyword">try</span> &#123;	</span><br><span class="line">             <span class="keyword">return</span> a+b;		</span><br><span class="line">         &#125; </span><br><span class="line">        <span class="keyword">catch</span> (Exception e) &#123;	</span><br><span class="line">            System.out.println(<span class="string">&quot;catch语句块&quot;</span>);	</span><br><span class="line">         &#125;	</span><br><span class="line">         <span class="keyword">finally</span>&#123;	</span><br><span class="line">             System.out.println(<span class="string">&quot;finally语句块&quot;</span>);	</span><br><span class="line">         &#125;	</span><br><span class="line">         <span class="keyword">return</span> <span class="number">0</span>;	</span><br><span class="line">    &#125; </span><br><span class="line">     <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String argv[])</span></span>&#123; </span><br><span class="line">         Test test =<span class="keyword">new</span> Test(); </span><br><span class="line">         System.out.println(<span class="string">&quot;和是：&quot;</span>+test.add(<span class="number">9</span>, <span class="number">34</span>)); </span><br><span class="line">     &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">catch语句块</span><br><span class="line">和是：43</span><br><span class="line"></span><br><span class="line">编译异常</span><br><span class="line"></span><br><span class="line">finally语句块（√）</span><br><span class="line">和是：43</span><br><span class="line"></span><br><span class="line">和是：43</span><br><span class="line">finally语句块</span><br></pre></td></tr></table></figure>
<p>举个例子：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">abstract</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(beforeFinally());</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">int</span> <span class="title">beforeFinally</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">int</span> a = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">try</span>&#123;</span><br><span class="line">            a = <span class="number">1</span>;</span><br><span class="line">            <span class="keyword">return</span> a;</span><br><span class="line">        &#125;<span class="keyword">finally</span>&#123;</span><br><span class="line">            a = <span class="number">2</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">/**output:</span></span><br><span class="line"><span class="comment">1</span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>
<p>从结果上看，貌似<code>finally</code> 里的语句是在<code>return</code> 之后执行的，其实不然，实际上<code>finally</code> 里的语句是在在<code>return</code> 之前执行的。那么问题来了，既然是在之前执行，那为什么<code>a</code> 的值没有被覆盖了？<br>实际过程是这样的：<strong>当程序执行到try{}语句中的return方法时，它会干这么一件事，将要返回的结果存储到一个临时栈中，然后程序不会立即返回，而是去执行finally{}中的程序，</strong> <strong>在执行<code>a = 2</code>时，程序仅仅是覆盖了a的值，但不会去更新临时栈中的那个要返回的值</strong> 。执行完之后，就会通知主程序“finally的程序执行完毕，可以请求返回了”，这时，就会将临时栈中的值取出来返回。这下应该清楚了，<strong>要返回的值是保存至临时栈中的。</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">abstract</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(beforeFinally());</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">int</span> <span class="title">beforeFinally</span><span class="params">()</span></span>&#123;</span><br><span class="line">        <span class="keyword">int</span> a = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">try</span>&#123;</span><br><span class="line">            a = <span class="number">1</span>;</span><br><span class="line">            <span class="keyword">return</span> a;</span><br><span class="line">        &#125;<span class="keyword">finally</span>&#123;</span><br><span class="line">            a = <span class="number">2</span>;</span><br><span class="line">            <span class="keyword">return</span> a;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">/**output:</span></span><br><span class="line"><span class="comment">2</span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>
<p>在这里，finally{}里也有一个return，那么在执行这个return时，就会更新临时栈中的值。同样，在执行完finally之后，就会通知主程序请求返回了，即将临时栈中的值取出来返回。故返回值是2.</p>
<h3 id="2、Thread-sleep-是否会抛出checked-exception"><a href="#2、Thread-sleep-是否会抛出checked-exception" class="headerlink" title="2、Thread. sleep()是否会抛出checked exception?"></a>2、Thread. sleep()是否会抛出checked exception?</h3><p>checked exception：指的是编译时异常，该类异常需要本函数必须处理的，用try和catch处理，或者用throws抛出异常，然后交给调用者去处理异常。</p>
<p>runtime exception：指的是运行时异常，该类异常不必须本函数必须处理，当然也可以处理。</p>
<p>Thread.sleep()抛出的InterruptException属于checked exception；IllegalArgumentException属于Runtime exception;</p>
<h3 id="3、如果一个list初始化为-5，3，1-，执行以下代码后，其结果为（）？"><a href="#3、如果一个list初始化为-5，3，1-，执行以下代码后，其结果为（）？" class="headerlink" title="3、如果一个list初始化为{5，3，1}，执行以下代码后，其结果为（）？"></a>3、如果一个list初始化为{5，3，1}，执行以下代码后，其结果为（）？</h3><p>nums.add(6);<br>nums.add(0,4);<br>nums.remove(1);</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[5, 3, 1, 6]</span><br><span class="line">[4, 3, 1, 6]（√）</span><br><span class="line">[4, 3, 6]</span><br><span class="line">[5, 3, 6]</span><br></pre></td></tr></table></figure>
<p>list{5,3,1}</p>
<p>nums.add(6); //往后边加一个6，{5，3，1，6}</p>
<p>nums.add(0,4);//往下标为0的数加一个4，{4，5，3，1，6}</p>
<p>nums.remove(1); // 移除下标为1 的元素，{4，3，1，6}</p>
<h3 id="4、下列语句哪一个是不正确的（）"><a href="#4、下列语句哪一个是不正确的（）" class="headerlink" title="4、下列语句哪一个是不正确的（）"></a>4、下列语句哪一个是不正确的（）</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Log4j支持按分钟为间隔生成新的日志文件</span><br><span class="line">Log4j是一个打印日志用的组件</span><br><span class="line">Log4j支持按年为间隔生成新的日志文件</span><br><span class="line">Log4j的日志打印级别可以在运行时重新设置（x）</span><br></pre></td></tr></table></figure>
<p>日志的级别之间的大小关系如右所示：ALL &lt; TRACE &lt; DEBUG &lt; INFO &lt; WARN &lt; ERROR &lt; FATAL &lt; OFF Log4j建议只使用四个级别，优先级从高到低分别是 ERROR &gt; WARN &gt; INFO &gt; DEBUG。 log4j在运行期间是不可以重新设置的</p>
<h3 id="5、关于AWT和Swing说法正确的是？"><a href="#5、关于AWT和Swing说法正确的是？" class="headerlink" title="5、关于AWT和Swing说法正确的是？"></a>5、关于AWT和Swing说法正确的是？</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Swing是AWT的子类</span><br><span class="line">AWT在不同操作系统中显示相同的风格</span><br><span class="line">AWT不支持事件类型，Swing支持事件模型</span><br><span class="line">Swing在不同的操作系统中显示相同的风格（√）</span><br></pre></td></tr></table></figure>
<p>AWT和Swing都是java中的包。</p>
<p>AWT(Abstract Window Toolkit)：抽象窗口工具包，早期编写图形界面应用程序的包。</p>
<p>Swing ：为解决 AWT 存在的问题而新开发的图形界面包。Swing是对AWT的改良和扩展。  </p>
<p>AWT和Swing的实现原理不同：<br>    AWT的图形函数与操作系统提供的图形函数有着一一对应的关系。也就是说，当我们利用 AWT构件图形用户界面的时候，实际上是在利用操作系统的图形库。<br>    不同的操作系统其图形库的功能可能不一样，在一个平台上存在的功能在另外一个平台上则可能不存在。为了实现Java语言所宣称的”一次编译，到处运行”的概念，AWT不得不通过牺牲功能来实现平台无关性。因此，AWT 的图形功能是各操作系统图形功能的“交集”。<br>    因为AWT是依靠本地方法来实现功能的，所以AWT控件称为“重量级控件”。 </p>
<p>​    而Swing ，不仅提供了AWT 的所有功能，还用纯粹的Java代码对AWT的功能进行了大幅度的扩充。<br>​    例如：并不是所有的操作系统都提供了对树形控件的支持， Swing则利用了AWT中所提供的基本作图方法模拟了一个树形控件。<br>​    由于 Swing是用纯粹的Java代码来实现的，因此Swing控件在各平台通用。<br>​    因为Swing不使用本地方法，故Swing控件称为“轻量级控件”。 </p>
<p>​    AWT和Swing之间的区别：<br>​    1)AWT 是基于本地方法的C/C++程序，其运行速度比较快；Swing是基于AWT的Java程序，其运行速度比较慢。<br>​    2)AWT的控件在不同的平台可能表现不同，而Swing在所有平台表现一致。</p>
<p>​    在实际应用中，应该使用AWT还是Swing取决于应用程序所部署的平台类型。例如：<br>​    1)对于一个嵌入式应用，目标平台的硬件资源往往非常有限，而应用程序的运行速度又是项目中至关重要的因素。在这种矛盾的情况下，简单而高效的AWT当然成了嵌入式Java的第一选择。<br>​    2)在普通的基于PC或者是工作站的标准Java应用中，硬件资源对应用程序所造成的限制往往不是项目中的关键因素。所以在标准版的Java中则提倡使用Swing， 也就是通过牺牲速度来实现应用程序的功能。</p>
<p>出处：牛客网 <a target="_blank" rel="noopener" href="https://www.nowcoder.com/profile/564796">guanjian</a></p>
<h3 id="6、下面属于JSP内置对象的是？全部"><a href="#6、下面属于JSP内置对象的是？全部" class="headerlink" title="6、下面属于JSP内置对象的是？全部"></a>6、下面属于JSP内置对象的是？全部</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">out对象</span><br><span class="line">response对象</span><br><span class="line">application对象</span><br><span class="line">page对象</span><br></pre></td></tr></table></figure>
<p>pageContext javax.servlet.jsp.PageContext<br>request javax.servlet.http.HttpServletRequest<br>response javax.servlet.http.HttpServletResponse<br>session javax.servlet.http.HttpSession<br>application javax.servlet.ServletContext<br>config javax.serlvet.ServletConfig<br>exception java.lang.Throwable<br>page java.lang.Object<br>out javax.servlet.jsp.JspWriter<br>作用：<br>1、pageContext 表示<strong>页容器 EL表达式、 标签 、上传</strong><br>2、request 服务器端取得客户端的信息：<strong>头信息 、Cookie 、请求参数</strong> ，最大用处在MVC设计模式上<br>3、response 服务器端回应客户端信息：<strong>Cookie、重定向</strong><br>4、session <strong>表示每一个用户，用于登录验证上</strong><br>5、application <strong>表示整个服务器</strong><br>6、config <strong>取得初始化参数</strong>，初始化参数在web.xml文件中配置<br>7、exception 表示的是<strong>错误页的处理操作</strong><br>8、page 如同this一样，代表<strong>整个jsp页面自身</strong><br>9、out 输出 ，但是尽量使用表达式输出</p>
<h3 id="7、关于C-JAVA类中static-成员和对象成员的说法正确的是？"><a href="#7、关于C-JAVA类中static-成员和对象成员的说法正确的是？" class="headerlink" title="7、关于C++/JAVA类中static 成员和对象成员的说法正确的是？"></a>7、关于C++/JAVA类中static 成员和对象成员的说法正确的是？</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">static 成员变量在对象构造时生成</span><br><span class="line">static 成员函数在对象成员函数中无法调用</span><br><span class="line">虚成员函数不可能是static 成员函数（√）</span><br><span class="line">static 成员函数不能访问static 成员变量</span><br></pre></td></tr></table></figure>
<p>static成员变量是在类加载的时候生成的</p>
<p>static成员函数既可以通过类名直接调用，也可以通过对象名进行调用</p>
<p>虚函数是C++中的，虚函数不可能是static的</p>
<p>static成员函数可以访问static成员变量</p>
<h3 id="8、下列说法正确的是"><a href="#8、下列说法正确的是" class="headerlink" title="8、下列说法正确的是( )"></a>8、下列说法正确的是( )</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">volatile,synchronized 都可以修改变量，方法以及代码块</span><br><span class="line">volatile，synchronized 在多线程中都会存在阻塞问题</span><br><span class="line">volatile能保证数据的可见性，但不能完全保证数据的原子性，synchronized即保证了数据的可见性也保证了原子性（√）</span><br><span class="line">volatile解决的是变量在多个线程之间的可见性、原子性，而sychroized解决的是多个线程之间访问资源的同步性</span><br></pre></td></tr></table></figure>
<h3 id="synchronized关键字和volatile关键字比较："><a href="#synchronized关键字和volatile关键字比较：" class="headerlink" title="synchronized关键字和volatile关键字比较："></a>synchronized关键字和volatile关键字比较：</h3><ul>
<li>volatile关键字是线程同步的轻量级实现，所以volatile性能肯定比synchronized关键字要好。但是volatile关键字只能用于变量而synchronized关键字可以修饰方法以及代码块。synchronized关键字在JavaSE1.6之后进行了主要包括为了减少获得锁和释放锁带来的性能消耗而引入的偏向锁和轻量级锁以及其它各种优化之后执行效率有了显著提升，实际开发中使用 synchronized 关键字的场景还是更多一些。</li>
<li><strong>多线程访问volatile关键字不会发生阻塞，而synchronized关键字可能会发生阻塞</strong></li>
<li>volatile关键字能保证数据的可见性，但不能保证数据的原子性。synchronized关键字两者都能保证。b</li>
<li>volatile关键字主要用于<strong>解决变量在多个线程之间的可见性</strong>，而 synchronized关键字解决的是<strong>多个线程之间访问资源的同步性。</strong></li>
</ul>
<h3 id="9、运行下面代码，输出的结果是（）（不准再错了！！！！）"><a href="#9、运行下面代码，输出的结果是（）（不准再错了！！！！）" class="headerlink" title="9、运行下面代码，输出的结果是（）（不准再错了！！！！）"></a>9、运行下面代码，输出的结果是（）（不准再错了！！！！）</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">A</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">A</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">&quot;class A&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    &#123; System.out.println(<span class="string">&quot;I&#x27;m A class&quot;</span>); &#125; </span><br><span class="line">    <span class="keyword">static</span> &#123; System.out.println(<span class="string">&quot;class A static&quot;</span>); &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">B</span> <span class="keyword">extends</span> <span class="title">A</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">B</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="string">&quot;class B&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    &#123; System.out.println(<span class="string">&quot;I&#x27;m B class&quot;</span>); &#125;</span><br><span class="line">    <span class="keyword">static</span> &#123; System.out.println(<span class="string">&quot;class B static&quot;</span>); &#125;</span><br><span class="line">    </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123; </span><br><span class="line"> <span class="keyword">new</span> B(); </span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">class A static（√）</span><br><span class="line">class B static</span><br><span class="line">I&#39;m A class</span><br><span class="line">class A</span><br><span class="line">I&#39;m B class</span><br><span class="line">class B</span><br><span class="line"></span><br><span class="line">class A static</span><br><span class="line">I&#39;m A class</span><br><span class="line">class A</span><br><span class="line">class B static</span><br><span class="line">I&#39;m B class</span><br><span class="line">class B</span><br><span class="line"></span><br><span class="line">class A static</span><br><span class="line">class B static</span><br><span class="line">class A</span><br><span class="line">I&#39;m A class</span><br><span class="line">class B</span><br><span class="line">I&#39;m B class</span><br><span class="line"></span><br><span class="line">class A static</span><br><span class="line">class A</span><br><span class="line">I&#39;m A class</span><br><span class="line">class B static</span><br><span class="line">class B</span><br><span class="line">I&#39;m B class</span><br></pre></td></tr></table></figure>
<p><strong>Java程序初始化顺序：</strong></p>
<ol>
<li><strong>父类的静态代码块</strong></li>
<li><strong>子类的静态代码块</strong></li>
<li><strong>父类的普通代码块</strong></li>
<li><strong>父类的构造方法</strong></li>
<li><strong>子类的普通代码块</strong></li>
<li><strong>子类的构造方法</strong></li>
</ol>
<h3 id="10、以下代码执行后输出结果为（-）"><a href="#10、以下代码执行后输出结果为（-）" class="headerlink" title="10、以下代码执行后输出结果为（ ）"></a>10、以下代码执行后输出结果为（ ）</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span></span></span><br><span class="line"><span class="class"></span>&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> Test t1 = <span class="keyword">new</span> Test();</span><br><span class="line">    &#123;</span><br><span class="line">         System.out.println(<span class="string">&quot;blockA&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">static</span></span><br><span class="line">    &#123;</span><br><span class="line">        System.out.println(<span class="string">&quot;blockB&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        Test t2 = <span class="keyword">new</span> Test();</span><br><span class="line">    &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">blockAblockBblockA（√）</span><br><span class="line">blockAblockAblockB</span><br><span class="line">blockBblockBblockA</span><br><span class="line">blockBblockAblockB</span><br></pre></td></tr></table></figure>
<p>道理同上题</p>
<h3 id="11、ServletConfig接口默认是哪里实现的？"><a href="#11、ServletConfig接口默认是哪里实现的？" class="headerlink" title="11、ServletConfig接口默认是哪里实现的？"></a>11、ServletConfig接口默认是哪里实现的？</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Servlet</span><br><span class="line">GenericServlet</span><br><span class="line">HttpServlet</span><br><span class="line">用户自定义servlet</span><br></pre></td></tr></table></figure>
<p>接释：</p>
<p><a target="_blank" rel="noopener" href="https://uploadfiles.nowcoder.com/images/20171024/9430388_1508834386231_FE8B1A979ADF6E3C2C114AF3F9CA693C">https://uploadfiles.nowcoder.com/images/20171024/9430388_1508834386231_FE8B1A979ADF6E3C2C114AF3F9CA693C</a></p>
<p>12、关于下面一段代码，以下说法正确的是： ()</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="keyword">synchronized</span> <span class="keyword">void</span> <span class="title">a</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="keyword">void</span> <span class="title">b</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">synchronized</span> (<span class="keyword">this</span>) &#123;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="keyword">synchronized</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">c</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="keyword">void</span> <span class="title">d</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">synchronized</span> (Test.class) &#123;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">同一个对象，分别调用方法a和b，锁住的是同一个对象（√）</span><br><span class="line">同一个对象，分别调用方法a和c，锁住的是同一个对象</span><br><span class="line">同一个对象，分别调用方法b和c，锁住的不是同一个对象（√）</span><br><span class="line">同一个对象，分别调用方法a、b、c，锁住的不是同一个对象</span><br></pre></td></tr></table></figure>
<p><strong>修饰非静态方法 锁的是this 对象</strong></p>
<p><strong>修饰静态方法 锁的是class对象</strong></p>
<p>13、下面关于依赖注入(DI)的说法不正确的是()</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">只有通过Spring才能实现依赖注入(DI)（x）</span><br><span class="line">依赖注入的主要目的是解耦合</span><br><span class="line">常见的依赖注入方式有Setter和构造方法</span><br></pre></td></tr></table></figure>
<p>Spring依赖注入（DI）的三种方式，分别为：</p>
<p>1． 接口注入</p>
<p>2． Setter 方法注入</p>
<p>3． 构造方法注入</p>
<h3 id="14、以下代码的输出的正确结果是"><a href="#14、以下代码的输出的正确结果是" class="headerlink" title="14、以下代码的输出的正确结果是"></a>14、以下代码的输出的正确结果是</h3><p>public class Test {<br>public static void main(String args[]) {<br>String s = “祝你考出好成绩！”;<br>System.out.println(s.length());<br>}<br>}</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">24</span><br><span class="line">16</span><br><span class="line">15</span><br><span class="line">8</span><br></pre></td></tr></table></figure>
<p><strong>一个汉字等于一个字符　　 字符 是char</strong><br><strong>一个汉字也等于二个字节，字节 是byte</strong></p>
<h3 id="15、Java中浮点数默认是double类型，定义成float需要显示转换"><a href="#15、Java中浮点数默认是double类型，定义成float需要显示转换" class="headerlink" title="15、Java中浮点数默认是double类型，定义成float需要显示转换"></a>15、Java中浮点数默认是double类型，定义成float需要显示转换</h3><h3 id="16、子类要调用继承自父类的方法，必须使用super关键字。"><a href="#16、子类要调用继承自父类的方法，必须使用super关键字。" class="headerlink" title="16、子类要调用继承自父类的方法，必须使用super关键字。"></a>16、子类要调用继承自父类的方法，必须使用super关键字。</h3><p>1、子类构造函数调用父类构造函数用super</p>
<p>2、子类重写父类方法后，若想调用父类中被重写的方法，用super</p>
<p>3、未被重写的方法可以直接调用。</p>
<h3 id="16、socket编程中，以下哪个socket的操作是不属于服务端操作的（）？"><a href="#16、socket编程中，以下哪个socket的操作是不属于服务端操作的（）？" class="headerlink" title="16、socket编程中，以下哪个socket的操作是不属于服务端操作的（）？"></a>16、socket编程中，以下哪个socket的操作是不属于服务端操作的（）？</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">accept</span><br><span class="line">listen</span><br><span class="line">connect（√）</span><br><span class="line">close</span><br></pre></td></tr></table></figure>
<p>示意图<a target="_blank" rel="noopener" href="https://uploadfiles.nowcoder.com/images/20180316/8955099_1521189690989_0BB28C2A1ECCC47EC020E89E8A554BBC">https://uploadfiles.nowcoder.com/images/20180316/8955099_1521189690989_0BB28C2A1ECCC47EC020E89E8A554BBC</a></p>
<p>TCP客户端： </p>
<p>1.建立连接套接字，设置Ip和端口监听，socket()</p>
<p>2.建立连接 connect</p>
<p>3.write() 获取网络流对象 发送数据</p>
<p>4.read()获取网络流对象 接收数据</p>
<p>5.关闭套接字</p>
<p>TCP服务器端</p>
<p>1.建立端口监听 socket()</p>
<p>2.绑定指定端口 bind()</p>
<p>3.listen 进行端口监听</p>
<p>4.accept() 阻塞式 直到有客户端访问</p>
<p>5.read()获取客户端发送数据</p>
<p>6.write()发送返回数据</p>
<p>7.close关闭端口监听</p>
<h3 id="17、根据下面的程序代码，哪些选项的值返回true？"><a href="#17、根据下面的程序代码，哪些选项的值返回true？" class="headerlink" title="17、根据下面的程序代码，哪些选项的值返回true？"></a>17、根据下面的程序代码，哪些选项的值返回true？</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Square</span> </span>&#123;  </span><br><span class="line">    <span class="keyword">long</span> width;  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">Square</span><span class="params">(<span class="keyword">long</span> l)</span> </span>&#123;   </span><br><span class="line">        width = l;  </span><br><span class="line">    &#125;  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String arg[])</span> </span>&#123;   </span><br><span class="line">        Square a, b, c;   </span><br><span class="line">        a = <span class="keyword">new</span> Square(<span class="number">42L</span>);   </span><br><span class="line">        b = <span class="keyword">new</span> Square(<span class="number">42L</span>);   </span><br><span class="line">        c = b;   </span><br><span class="line">        <span class="keyword">long</span> s = <span class="number">42L</span>;  </span><br><span class="line">    &#125; </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">a &#x3D;&#x3D; b</span><br><span class="line">s &#x3D;&#x3D; a</span><br><span class="line">b &#x3D;&#x3D; c （√）</span><br><span class="line">a.equals(s)</span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">这题考的是引用和内存。</span><br><span class="line"><span class="comment">//声明了3个Square类型的变量a, b, c</span></span><br><span class="line"><span class="comment">//在stack中分配3个内存，名字为a, b, c</span></span><br><span class="line">Square a, b, c; </span><br><span class="line"><span class="comment">//在heap中分配了一块新内存，里边包含自己的成员变量width值为48L，然后stack中的a指向这块内存</span></span><br><span class="line">a = <span class="keyword">new</span> Square(<span class="number">42L</span>); </span><br><span class="line"><span class="comment">//在heap中分配了一块新内存，其中包含自己的成员变量width值为48L，然后stack中的b指向这块内存</span></span><br><span class="line">b = <span class="keyword">new</span> Square(<span class="number">42L</span>);   </span><br><span class="line"><span class="comment">//stack中的c也指向b所指向的内存</span></span><br><span class="line">c = b;</span><br><span class="line"><span class="comment">//在stack中分配了一块内存，值为42</span></span><br><span class="line"><span class="keyword">long</span> s = <span class="number">42L</span>; </span><br></pre></td></tr></table></figure>


<h3 id="18、下面有关java-hashmap的说法错误的是？"><a href="#18、下面有关java-hashmap的说法错误的是？" class="headerlink" title="18、下面有关java hashmap的说法错误的是？"></a>18、下面有关java hashmap的说法错误的是？</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">HashMap 的实例有两个参数影响其性能：“初始容量” 和 “加载因子”。</span><br><span class="line">HashMap 的实现不是同步的，意味着它不是线程安全的</span><br><span class="line">HashMap通过开放地址法解决哈希冲突（x）</span><br><span class="line">HashMap中的key-value都是存储在Entry数组中的</span><br></pre></td></tr></table></figure>
<p>在这里帮大家总结一下hashMap和hashtable方面的知识点吧：</p>
<ol>
<li><p>关于HashMap的一些说法：</p>
<p>a) HashMap实际上是一个“链表散列”的数据结构，即数组和链表的结合体。HashMap的底层结构是一个数组，数组中的每一项是一条链表。</p>
<p>b) HashMap的实例有俩个参数影响其性能： “初始容量” 和 装填因子。</p>
<p>c) HashMap实现不同步，线程不安全。  HashTable线程安全 </p>
<p>d) HashMap中的key-value都是存储在Entry中的。 </p>
<p>e) HashMap可以存null键和null值，不保证元素的顺序恒久不变，它的底层使用的是数组和链表，通过hashCode()方法和equals方法保证键的唯一性 </p>
<p>f) 解决冲突主要有三种方法：<strong>定址法，拉链法，再散列法</strong>。HashMap是采用<strong>拉链法</strong>解决哈希冲突的。 注： 链表法是将相同hash值的对象组成一个链表放在hash值对应的槽位；   用开放定址法解决冲突的做法是：当冲突发生时，使用某种探查(亦称探测)技术在散列表中形成一个探查(测)序列。 沿此序列逐个单元地查找，直到找到给定 的关键字，或者碰到一个开放的地址(即该地址单元为空)为止（若要插入，在探查到开放的地址，则可将待插入的新结点存人该地址单元）。  拉链法解决冲突的做法是： 将所有关键字为同义词的结点链接在同一个单链表中 。若选定的散列表长度为m，则可将散列表定义为一个由m个头指针组成的指针数 组T[0..m-1]。凡是散列地址为i的结点，均插入到以T[i]为头指针的单链表中。T中各分量的初值均应为空指针。在拉链法中，装填因子α可以大于1，但一般均取α≤1。<strong>拉链法适合未规定元素的大小</strong>。   </p>
</li>
</ol>
<ol start="2">
<li><h3 id="Hashtable和HashMap的区别："><a href="#Hashtable和HashMap的区别：" class="headerlink" title="Hashtable和HashMap的区别："></a>Hashtable和HashMap的区别：</h3><p>a)  继承不同。  public class Hashtable extends <strong>Dictionary</strong> implements Map public class HashMap extends  <strong>AbstractMap</strong> implements Map </p>
<p>b) Hashtable中的方法是<strong>同步</strong>的，而HashMap中的方法在缺省情况下是<strong>非同步</strong>的。在多线程并发的环境下，可以直接使用Hashtable，但是要使用HashMap的话就要自己增加同步处理了。 </p>
<p>c) <strong>Hashtable 中， key 和 value 都不允许出现 null 值</strong>。 在 HashMap 中， null 可以作为键，这样的键只有一个；可以有一个或多个键所对应的值为 null 。当 get() 方法返回 null 值时，即可以表示 HashMap 中没有该键，也可以表示该键所对应的值为 null 。因此，<strong>在 HashMap 中不能由 get() 方法来判断 HashMap 中是否存在某个键</strong>， 而<strong>应该用 containsKey() 方法来判断</strong>。 </p>
<p>d) 两个遍历方式的内部实现上不同。<strong>Hashtable、HashMap都使用了Iterator</strong>。而由于历史原因，Hashtable还使用了Enumeration的方式 。 </p>
<p>e) 哈希值的使用不同，<strong>HashTable直接使用对象的hashCode</strong>。<strong>而HashMap重新计算hash值</strong>。 </p>
<p>f) Hashtable和HashMap它们两个内部实现方式的数组的初始大小和扩容的方式。H*<em>ashTable中hash数组默认大小是11，增加的方式是old</em>2+1<strong>。</strong>HashMap中hash数组的默认大小是16，而且一定是2的指数<strong>。  注：  HashSet子类依靠hashCode()和equal()方法来区分重复元素。    HashSet内部使用Map保存数据，即</strong>将HashSet的数据作为Map的key值保存**，这也是HashSet中元素不能重复的原因。而Map中保存key值的,会去判断当前Map中是否含有该Key对象，内部是先通过key的hashCode,确定有相同的hashCode之后，再通过equals方法判断是否相同。</p>
</li>
</ol>
<h3 id="19、在java中，下列对继承的说法，正确的是（-）"><a href="#19、在java中，下列对继承的说法，正确的是（-）" class="headerlink" title="19、在java中，下列对继承的说法，正确的是（ ）"></a>19、在java中，下列对继承的说法，正确的是（ ）</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">子类能继承父类的所有成员（√）</span><br><span class="line">子类继承父类的非私有方法和状态</span><br><span class="line">子类只能继承父类的public方法和状态</span><br><span class="line">子类只能继承父类的方法</span><br></pre></td></tr></table></figure>
<p><strong>使用反射可以看出子类是继承了父类的私有方法的(不管是否是final)，只是直接调用父类的私有方法是不可以的，但是利用反射的方式可以调用。字段同理。</strong></p>
<h3 id="20、根据下面这个程序的内容，判断哪些描述是正确的：（-）"><a href="#20、根据下面这个程序的内容，判断哪些描述是正确的：（-）" class="headerlink" title="20、根据下面这个程序的内容，判断哪些描述是正确的：（ ）"></a>20、根据下面这个程序的内容，判断哪些描述是正确的：（ ）</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span> </span>&#123;</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String args[])</span> </span>&#123;</span><br><span class="line">String s = <span class="string">&quot;tommy&quot;</span>;</span><br><span class="line">Object o = s;</span><br><span class="line">sayHello(o); <span class="comment">//语句1</span></span><br><span class="line">sayHello(s); <span class="comment">//语句2</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(String to)</span> </span>&#123;</span><br><span class="line">System.out.println(String.format(<span class="string">&quot;Hello, %s&quot;</span>, to));</span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(Object to)</span> </span>&#123;</span><br><span class="line">System.out.println(String.format(<span class="string">&quot;Welcome, %s&quot;</span>, to));</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">这段程序有编译错误</span><br><span class="line">语句1输出为:Hello, tommy</span><br><span class="line">语句2输出为:Hello, tommy</span><br><span class="line">语句1输出为:Welcome, tommy（√）</span><br><span class="line">语句2输出为:Welcome, tommy（√）</span><br><span class="line">根据选用的Java编译器不同，这段程序的输出可能不同</span><br></pre></td></tr></table></figure>


<p>20、关于Java的一些概念，下面哪些描述是正确的：(  )</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">所有的Java异常和错误的基类都是java.lang.Exception, 包括java.lang.RuntimeException</span><br><span class="line">通过try … catch … finally语句，finally中的语句部分无论发生什么异常都会得到执行（√）</span><br><span class="line">java中所有的数据都是对象</span><br><span class="line">Java通过垃圾回收回收不再引用的变量，垃圾回收时对象的finallize方法一定会得到执行</span><br><span class="line">Java是跨平台的语言，无论通过哪个版本的Java编写的程序都能在所有的Java运行平台中运行</span><br><span class="line">Java通过synchronized进行访问的同步，synchronized作用非静态成员方法和静态成员方法上同步的目标是不同的（√）</span><br></pre></td></tr></table></figure>
<p>A、java异常和错误的基类Throwable,包括Exception和Error</p>
<p>B、try…catch…finally finally不管什么异常都会执行</p>
<p>C、java是面向对象的，但是不是所有的都是对象，基本数据类型就不是对象，所以才会有封装类的；</p>
<p>D、如果是等待清理队列中如果又被调用，则不会执行finallize方法（垃圾回收器并不总是工作，只有当内存资源告急时，垃圾回收器才会工作；即使垃圾回收器工作，finalize方法也不一定得到执行，这是由于程序中的其他线程的优先级远远高于执行finalize（）函数线程的优先级。）</p>
<p>E、JAVA跨平台性  实现在任意平台的java程序都可以在其他平台运行</p>
<p>F、synchronized实现方式：三种</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">蔡哞哞</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://caixm1025.gitee.io/2021/03/03/03-03%E9%9D%A2%E8%AF%95%E9%A2%98%E5%AD%A6%E4%B9%A0/">https://caixm1025.gitee.io/2021/03/03/03-03%E9%9D%A2%E8%AF%95%E9%A2%98%E5%AD%A6%E4%B9%A0/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://caixm1025.gitee.io" target="_blank">个人博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/everyday/tags/Java%E5%9F%BA%E7%A1%80/">Java基础</a><a class="post-meta__tags" href="/everyday/tags/%E9%94%99%E9%A2%98%E9%9B%86/">错题集</a><a class="post-meta__tags" href="/everyday/tags/%E7%9F%A5%E8%AF%86%E7%82%B9%E8%A1%A5%E5%85%85/">知识点补充</a></div><div class="post_share"><div class="social-share" data-image="/everyday/img/%E5%9B%BE%E7%89%873.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/everyday/2021/03/04/03-04%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AD%A6%E4%B9%A0/"><img class="prev-cover" src="/everyday/img/%E5%9B%BE%E7%89%874.jpg" onerror="onerror=null;src='/everyday/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">03-04数据库学习</div></div></a></div><div class="next-post pull-right"><a href="/everyday/2021/03/02/03-02%E7%AE%97%E6%B3%95%E5%AD%A6%E4%B9%A0/"><img class="next-cover" src="/everyday/img/%E5%9B%BE%E7%89%872.jpg" onerror="onerror=null;src='/everyday/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">03-02算法学习</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/everyday/2021/02/27/02-27面试题学习/" title="02-27面试题学习"><img class="cover" src="/everyday/img/%E5%9B%BE%E7%89%8727.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-27</div><div class="title">02-27面试题学习</div></div></a></div><div><a href="/everyday/2021/02/28/02-28面试题学习/" title="02-28面试题学习"><img class="cover" src="/everyday/img/%E5%9B%BE%E7%89%8728.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-28</div><div class="title">02-28面试题学习</div></div></a></div><div><a href="/everyday/2021/02/20/02-20Java学习/" title="02-20Java学习"><img class="cover" src="/everyday/img/%E5%9B%BE%E7%89%8720.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-20</div><div class="title">02-20Java学习</div></div></a></div><div><a href="/everyday/2021/02/21/02-21Java学习/" title="02-21Java学习"><img class="cover" src="/everyday/img/%E5%9B%BE%E7%89%8721.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-21</div><div class="title">02-21Java学习</div></div></a></div><div><a href="/everyday/2021/02/23/02-23Java学习/" title="02-23Java学习"><img class="cover" src="/everyday/img/%E5%9B%BE%E7%89%8723.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-23</div><div class="title">02-23Java学习</div></div></a></div><div><a href="/everyday/2021/02/22/02-22Java学习/" title="02-22Java学习"><img class="cover" src="/everyday/img/%E5%9B%BE%E7%89%8722.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-22</div><div class="title">02-22Java学习</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E4%B8%8B%E9%9D%A2%E4%BB%A3%E7%A0%81%E8%BF%90%E8%A1%8C%E7%BB%93%E6%9E%9C%E6%98%AF%EF%BC%88%EF%BC%89"><span class="toc-number">1.</span> <span class="toc-text">1、下面代码运行结果是（）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81Thread-sleep-%E6%98%AF%E5%90%A6%E4%BC%9A%E6%8A%9B%E5%87%BAchecked-exception"><span class="toc-number">2.</span> <span class="toc-text">2、Thread. sleep()是否会抛出checked exception?</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E5%A6%82%E6%9E%9C%E4%B8%80%E4%B8%AAlist%E5%88%9D%E5%A7%8B%E5%8C%96%E4%B8%BA-5%EF%BC%8C3%EF%BC%8C1-%EF%BC%8C%E6%89%A7%E8%A1%8C%E4%BB%A5%E4%B8%8B%E4%BB%A3%E7%A0%81%E5%90%8E%EF%BC%8C%E5%85%B6%E7%BB%93%E6%9E%9C%E4%B8%BA%EF%BC%88%EF%BC%89%EF%BC%9F"><span class="toc-number">3.</span> <span class="toc-text">3、如果一个list初始化为{5，3，1}，执行以下代码后，其结果为（）？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81%E4%B8%8B%E5%88%97%E8%AF%AD%E5%8F%A5%E5%93%AA%E4%B8%80%E4%B8%AA%E6%98%AF%E4%B8%8D%E6%AD%A3%E7%A1%AE%E7%9A%84%EF%BC%88%EF%BC%89"><span class="toc-number">4.</span> <span class="toc-text">4、下列语句哪一个是不正确的（）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5%E3%80%81%E5%85%B3%E4%BA%8EAWT%E5%92%8CSwing%E8%AF%B4%E6%B3%95%E6%AD%A3%E7%A1%AE%E7%9A%84%E6%98%AF%EF%BC%9F"><span class="toc-number">5.</span> <span class="toc-text">5、关于AWT和Swing说法正确的是？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6%E3%80%81%E4%B8%8B%E9%9D%A2%E5%B1%9E%E4%BA%8EJSP%E5%86%85%E7%BD%AE%E5%AF%B9%E8%B1%A1%E7%9A%84%E6%98%AF%EF%BC%9F%E5%85%A8%E9%83%A8"><span class="toc-number">6.</span> <span class="toc-text">6、下面属于JSP内置对象的是？全部</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7%E3%80%81%E5%85%B3%E4%BA%8EC-JAVA%E7%B1%BB%E4%B8%ADstatic-%E6%88%90%E5%91%98%E5%92%8C%E5%AF%B9%E8%B1%A1%E6%88%90%E5%91%98%E7%9A%84%E8%AF%B4%E6%B3%95%E6%AD%A3%E7%A1%AE%E7%9A%84%E6%98%AF%EF%BC%9F"><span class="toc-number">7.</span> <span class="toc-text">7、关于C++&#x2F;JAVA类中static 成员和对象成员的说法正确的是？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8%E3%80%81%E4%B8%8B%E5%88%97%E8%AF%B4%E6%B3%95%E6%AD%A3%E7%A1%AE%E7%9A%84%E6%98%AF"><span class="toc-number">8.</span> <span class="toc-text">8、下列说法正确的是( )</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#synchronized%E5%85%B3%E9%94%AE%E5%AD%97%E5%92%8Cvolatile%E5%85%B3%E9%94%AE%E5%AD%97%E6%AF%94%E8%BE%83%EF%BC%9A"><span class="toc-number">9.</span> <span class="toc-text">synchronized关键字和volatile关键字比较：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9%E3%80%81%E8%BF%90%E8%A1%8C%E4%B8%8B%E9%9D%A2%E4%BB%A3%E7%A0%81%EF%BC%8C%E8%BE%93%E5%87%BA%E7%9A%84%E7%BB%93%E6%9E%9C%E6%98%AF%EF%BC%88%EF%BC%89%EF%BC%88%E4%B8%8D%E5%87%86%E5%86%8D%E9%94%99%E4%BA%86%EF%BC%81%EF%BC%81%EF%BC%81%EF%BC%81%EF%BC%89"><span class="toc-number">10.</span> <span class="toc-text">9、运行下面代码，输出的结果是（）（不准再错了！！！！）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10%E3%80%81%E4%BB%A5%E4%B8%8B%E4%BB%A3%E7%A0%81%E6%89%A7%E8%A1%8C%E5%90%8E%E8%BE%93%E5%87%BA%E7%BB%93%E6%9E%9C%E4%B8%BA%EF%BC%88-%EF%BC%89"><span class="toc-number">11.</span> <span class="toc-text">10、以下代码执行后输出结果为（ ）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11%E3%80%81ServletConfig%E6%8E%A5%E5%8F%A3%E9%BB%98%E8%AE%A4%E6%98%AF%E5%93%AA%E9%87%8C%E5%AE%9E%E7%8E%B0%E7%9A%84%EF%BC%9F"><span class="toc-number">12.</span> <span class="toc-text">11、ServletConfig接口默认是哪里实现的？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#14%E3%80%81%E4%BB%A5%E4%B8%8B%E4%BB%A3%E7%A0%81%E7%9A%84%E8%BE%93%E5%87%BA%E7%9A%84%E6%AD%A3%E7%A1%AE%E7%BB%93%E6%9E%9C%E6%98%AF"><span class="toc-number">13.</span> <span class="toc-text">14、以下代码的输出的正确结果是</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#15%E3%80%81Java%E4%B8%AD%E6%B5%AE%E7%82%B9%E6%95%B0%E9%BB%98%E8%AE%A4%E6%98%AFdouble%E7%B1%BB%E5%9E%8B%EF%BC%8C%E5%AE%9A%E4%B9%89%E6%88%90float%E9%9C%80%E8%A6%81%E6%98%BE%E7%A4%BA%E8%BD%AC%E6%8D%A2"><span class="toc-number">14.</span> <span class="toc-text">15、Java中浮点数默认是double类型，定义成float需要显示转换</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16%E3%80%81%E5%AD%90%E7%B1%BB%E8%A6%81%E8%B0%83%E7%94%A8%E7%BB%A7%E6%89%BF%E8%87%AA%E7%88%B6%E7%B1%BB%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%8C%E5%BF%85%E9%A1%BB%E4%BD%BF%E7%94%A8super%E5%85%B3%E9%94%AE%E5%AD%97%E3%80%82"><span class="toc-number">15.</span> <span class="toc-text">16、子类要调用继承自父类的方法，必须使用super关键字。</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16%E3%80%81socket%E7%BC%96%E7%A8%8B%E4%B8%AD%EF%BC%8C%E4%BB%A5%E4%B8%8B%E5%93%AA%E4%B8%AAsocket%E7%9A%84%E6%93%8D%E4%BD%9C%E6%98%AF%E4%B8%8D%E5%B1%9E%E4%BA%8E%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%93%8D%E4%BD%9C%E7%9A%84%EF%BC%88%EF%BC%89%EF%BC%9F"><span class="toc-number">16.</span> <span class="toc-text">16、socket编程中，以下哪个socket的操作是不属于服务端操作的（）？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17%E3%80%81%E6%A0%B9%E6%8D%AE%E4%B8%8B%E9%9D%A2%E7%9A%84%E7%A8%8B%E5%BA%8F%E4%BB%A3%E7%A0%81%EF%BC%8C%E5%93%AA%E4%BA%9B%E9%80%89%E9%A1%B9%E7%9A%84%E5%80%BC%E8%BF%94%E5%9B%9Etrue%EF%BC%9F"><span class="toc-number">17.</span> <span class="toc-text">17、根据下面的程序代码，哪些选项的值返回true？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#18%E3%80%81%E4%B8%8B%E9%9D%A2%E6%9C%89%E5%85%B3java-hashmap%E7%9A%84%E8%AF%B4%E6%B3%95%E9%94%99%E8%AF%AF%E7%9A%84%E6%98%AF%EF%BC%9F"><span class="toc-number">18.</span> <span class="toc-text">18、下面有关java hashmap的说法错误的是？</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Hashtable%E5%92%8CHashMap%E7%9A%84%E5%8C%BA%E5%88%AB%EF%BC%9A"><span class="toc-number">19.</span> <span class="toc-text">Hashtable和HashMap的区别：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#19%E3%80%81%E5%9C%A8java%E4%B8%AD%EF%BC%8C%E4%B8%8B%E5%88%97%E5%AF%B9%E7%BB%A7%E6%89%BF%E7%9A%84%E8%AF%B4%E6%B3%95%EF%BC%8C%E6%AD%A3%E7%A1%AE%E7%9A%84%E6%98%AF%EF%BC%88-%EF%BC%89"><span class="toc-number">20.</span> <span class="toc-text">19、在java中，下列对继承的说法，正确的是（ ）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#20%E3%80%81%E6%A0%B9%E6%8D%AE%E4%B8%8B%E9%9D%A2%E8%BF%99%E4%B8%AA%E7%A8%8B%E5%BA%8F%E7%9A%84%E5%86%85%E5%AE%B9%EF%BC%8C%E5%88%A4%E6%96%AD%E5%93%AA%E4%BA%9B%E6%8F%8F%E8%BF%B0%E6%98%AF%E6%AD%A3%E7%A1%AE%E7%9A%84%EF%BC%9A%EF%BC%88-%EF%BC%89"><span class="toc-number">21.</span> <span class="toc-text">20、根据下面这个程序的内容，判断哪些描述是正确的：（ ）</span></a></li></ol></div></div></div></div></main><footer id="footer" style="background-image: url(/everyday/img/%E5%9B%BE%E7%89%873.jpg)"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 蔡哞哞</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">好好学习，<a  target="_blank" rel="noopener" href="https://butterfly.js.org/">天天向上</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/everyday/js/utils.js"></script><script src="/everyday/js/main.js"></script><div class="js-pjax"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="false"></script></div></body></html>